package View;

import javax.swing.*;
import javax.swing.border.EmptyBorder;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;

/**
 * InfoContactPane is the pane which displays the information about the contact selected
 * @author Johanna
 *
 */
public class InfoContactPane extends JPanel {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JPanel buttonsPane;
	
	private JButton modifyButton;
	private JButton deleteButton;
	private JButton sendMailButton;
	private JButton homepageButton;
	
	private JTextArea info;
	
	public static final String INFO_TITLE = "INFORMATION ABOUT THE CONTACT";
	public static final String MODIFY = "Modify this contact";
	public static final String DELETE = "Delete this contact";
	public static final String SEND_MAIL = "Send him/her an e-mail";
	public static final String HOMEPAGE = "See his/her homepage";
	
	/** 
	 * Constructor
	 */
	public InfoContactPane() {
		
		add(new JLabel(INFO_TITLE), BorderLayout.NORTH);
		
		info = new JTextArea(12,43);
		add(info,BorderLayout.CENTER);
		
		// Buttons
		this.buttonsPane = new JPanel(new GridLayout(2,2,5,5));
		
		this.sendMailButton = new JButton(); 
		this.sendMailButton.setText(SEND_MAIL); 
		buttonsPane.add(this.sendMailButton);
		
		this.homepageButton = new JButton(); 
		this.homepageButton.setText(HOMEPAGE); 
		buttonsPane.add(this.homepageButton);
		
		this.modifyButton = new JButton(); 
		this.modifyButton.setText(MODIFY); 
		buttonsPane.add(this.modifyButton);
		
		this.deleteButton = new JButton(); 
		this.deleteButton.setText(DELETE); 
		buttonsPane.add(this.deleteButton);
		
		buttonsPane.setBorder(new EmptyBorder(0, 5, 5, 5) );
		
		// Organize the layout
		add(buttonsPane, BorderLayout.SOUTH);
		
		((JComponent) this).setBorder(new EmptyBorder(15, 15, 15, 15));
		this.setPreferredSize(new Dimension(500,300));
	}
	
	public JTextArea getInfo(){
		return info;
	}
	
	public void setInfo(JTextArea newTextArea) {
		this.info = newTextArea; 
	}
	
	public JButton getDeleteButton()
	{
		return this.deleteButton;
	}
	
	public JButton getModifyButton()
	{
		return this.modifyButton;
	}
	
	public JButton getSendMailButton()
	{
		return this.sendMailButton;
	}
	
	public JButton getHomepageButton()
	{
		return this.homepageButton;
	}

}